package Meituan;

/**
 * 找出数组中的最大值
 * @author: leiwenkang02@meituan.com
 * @date: 2018/8/2
 * @time: 15:34
 */
public class Test19 {
    public static void main(String[] args) {
        int[] array = {3,6,2,8,1,8,3,5,1,6};
        System.out.println(findMaxValue(array));
    }

    public static int findMaxValue(int[] array) {
        if (array == null || array.length == 0) {
            throw new RuntimeException("输入不合法");
        }
        int max = array[0];
        for (int i = 1; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
            }
        }
        return max;
    }
}
